package com.px.framework.web.service;

import com.github.houbb.sensitive.word.api.IWordAllow;
import com.px.service.domain.SensitiveWord;
import com.px.service.service.ISensitiveWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: Alvin
 * @date: Created in 2022/5/4
 * @description:
 */
@Service
public class WordAllowService implements IWordAllow {

    @Autowired
    private ISensitiveWordService mSensitiveWordService;

    @Override
    public List<String> allow() {
        SensitiveWord param = new SensitiveWord();
        param.setType(1);
        return mSensitiveWordService.selectSensitiveWordList(param).stream().map(SensitiveWord::getWord).collect(Collectors.toList());
    }
}
